/* 
 * Copyright (c) 2008 Knightsoft
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/
package com.knightsoft.util;

/**
 * @version 1.0 11/08/08
 * @author Michael
 *
 */
public class ConvertTo {
	public static boolean[] primitive(Boolean[] in) {
		boolean[] result = new boolean[in.length];
		for (int i = 0; i < in.length; i++)
			result[i] = in[i]; // Autounboxing
		return result;
	}

	public static char[] primitive(Character[] in) {
		char[] result = new char[in.length];
		for (int i = 0; i < in.length; i++)
			result[i] = in[i];
		return result;
	}

	public static byte[] primitive(Byte[] in) {
		byte[] result = new byte[in.length];
		for (int i = 0; i < in.length; i++)
			result[i] = in[i];
		return result;
	}

	public static short[] primitive(Short[] in) {
		short[] result = new short[in.length];
		for (int i = 0; i < in.length; i++)
			result[i] = in[i];
		return result;
	}

	public static int[] primitive(Integer[] in) {
		int[] result = new int[in.length];
		for (int i = 0; i < in.length; i++)
			result[i] = in[i];
		return result;
	}

	public static long[] primitive(Long[] in) {
		long[] result = new long[in.length];
		for (int i = 0; i < in.length; i++)
			result[i] = in[i];
		return result;
	}

	public static float[] primitive(Float[] in) {
		float[] result = new float[in.length];
		for (int i = 0; i < in.length; i++)
			result[i] = in[i];
		return result;
	}

	public static double[] primitive(Double[] in) {
		double[] result = new double[in.length];
		for (int i = 0; i < in.length; i++)
			result[i] = in[i];
		return result;
	}
} 
